<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<div class="panel">
    <div id="classes-heading" class="panel-heading bg-gray-light">
        <h3 class="panel-title">指标评测<span id="title-duty-name-targetEvaluate" class="text-muted"> | </span></h3>
    </div>

    <div class="panel-body">
        <form th:id="'form_targetEvaluate_input'+${targetEvaluate?.id}" class="form-horizontal" autocomplete="off">
            <input type="hidden" name="keyId" th:value="${targetEvaluate?.id}">
            <input type="hidden" name="flowDutyId">
            <input type="hidden" name="flowDutyName">

            <th:block th:each="dict,i : ${targetEvaluate?.detailList}">

                <div class="form-group" data-title="evaluateDetail">
                    <label class="col-md-3 control-label">[[${dict.dictName}]]<i class="fa fa-asterisk txt-color-red"></i></label>
                    <div class="col-md-8">
                        <div data-title="evaluateDetail-radio" class="radio" th:id="${dict.id}" th:data-dict-id="${dict.dictId}">
                            <th:block th:each="index:${#numbers.sequence(-5,5)}" th:if="${index != 0}">
                                <input type="radio" th:name="'score_'+${i.index}" th:id="'score_'+${i.index}+'_'+${index}" th:value="${index}" class="magic-radio" th:checked="${dict.score == index}" >
                                <label th:for="'score_'+${i.index}+'_'+${index}" th:text="${index}"></label>
                            </th:block>
                        </div>
                    </div>
                </div>

            </th:block>


        </form>
    </div>
</div>

<script th:inline="javascript">
    var keyId_targetEvaluate = [[${targetEvaluate?.id}]];
    var flowData_targetEvaluate = {
        keyId : keyId_targetEvaluate ? keyId_targetEvaluate : "create",
        formId : "form_targetEvaluate_input"+[[${targetEvaluate?.id}]],
        path : "com.hanqian.kepler.core.entity.primary.core.TargetEvaluate",
        titleId : "title-duty-name-targetEvaluate"
    };
    var $form = $("#"+flowData_targetEvaluate.formId);

    $(function(){
        $form.find("input,select").attr("disabled", true);

        __flow_duty_handle(flowData_targetEvaluate);
        __flow_button_read_handle(flowData_targetEvaluate, fn_targetEvaluate_approve, fn_targetEvaluate_back, fn_targetEvaluate_deny, fn_targetEvaluate_edit, fn_targetEvaluate_withdraw);
    });

    function fn_targetEvaluate_approve(){
        __confirm_dialog("", "确定通过审批吗？", function(dialogRef){
            __form_save(flowData_targetEvaluate.formId, ctx+"targetEvaluate/approve", function(data){
                if(data && data.state === 1){
                    dialogRef.close();
                    __flow_close_layx(flowData_targetEvaluate);
                }
            })
        });
    }

    function fn_targetEvaluate_back(){
        __confirm_dialog("", "确定退回吗？", function(dialogRef){
            __form_save(flowData_targetEvaluate.formId, ctx+"targetEvaluate/back", function(data){
                if(data && data.state === 1){
                    dialogRef.close();
                    __flow_close_layx(flowData_targetEvaluate);
                }
            })
        });
    }

    function fn_targetEvaluate_deny(){
        __confirm_dialog("", "确定否决吗？", function(dialogRef){
            __form_save(flowData_targetEvaluate.formId, ctx+"targetEvaluate/deny", function(data){
                if(data && data.state === 1){
                    dialogRef.close();
                    __flow_close_layx(flowData_targetEvaluate);
                }
            })
        });
    }

    function fn_targetEvaluate_edit(){
        __flow_close_layx(flowData_targetEvaluate);
        __layX_html_read(flowData_targetEvaluate.keyId, "指标评测", ctx+"targetEvaluate/input?keyId="+flowData_targetEvaluate.keyId);
    }

    function fn_targetEvaluate_withdraw(){
        __confirm_dialog("", "确定撤回吗？", function(dialogRef){
            __form_save(flowData_targetEvaluate.formId, ctx+"targetEvaluate/withdraw", function(data){
                if(data && data.state === 1){
                    dialogRef.close();
                    __flow_close_layx(flowData_targetEvaluate);
                }
            })
        });
    }


</script>

</html>